﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GylCSharpUtils.GSerializer.Utils {
    public class ObjInfo {
        public SerialObjID sID { get; private set; }
        public object Obj { get; private set; }
        private List<RefInfo> References = new List<RefInfo>();

        public ObjInfo(SerialObjID serialObjID, object obj) {
            this.sID = serialObjID;
            this.Obj = obj;
        }

        /// <summary>
        /// 添加引用对象
        /// </summary>
        /// <param name="tag">标记信息</param>
        /// <param name="sourcePtr">源地址</param>
        /// <param name="targetPtr">目标地址</param>
        public RefInfo AddReferInfo(string tag, SerialObjID sourcePtr, SerialObjID targetPtr) {
            var refInfo = new RefInfo(tag, sourcePtr, targetPtr);
            References.Add(refInfo);
            return refInfo;
        }
    }
}
